<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/metro/easyui.css"/>
<link rel="stylesheet" href="static/easyui/themes/icon.css"/>
<title>药房发药</title>
</head>
<body>
<script type="text/javascript">
$(function() {
	//住院已经发完药记录
	$('#outPatientDrug-tabRecord-Inhospital').datagrid({
	    url:'select_publicDrug_Inhospital?docdetails_type='+2+"&publicdurg_type="+2,
	    pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,4],
	    columns:[[
    		{field:'publicdurg_id',title:'发药单号',width:203.2},
			{field:'publicdurg_shuliang',title:'请领的发药数量',width:203.2},
			{field:'publicdurg_allmoney',title:'请领发药总金额',width:200.2},
			{field:'publicdurg_peope',title:'请领人',width:205},
			{field:'p_works',title:'操作',width:203.2,
				formatter:function(value,row,index){ 
				 //按钮
				 return "<a  class='lookout_drug_inhospital  easyui-linkbutton' onclick='lookout_drug_inhospital_record("+row.publicdurg_id+")'>查看记录</a>";
				}		
			}
	    ]]
	}); 
	
	//住院已经发药文本框查询
	$("#search-sickname-inhospital").searchbox({
		searcher:function(value){
			//访问数据源、初始化表格
				$('#outPatientDrug-tabRecord-Inhospital').datagrid({
				    url:'select_publicDrug_Inhospital?docdetails_type='+2+"&publicdurg_type="+2,
				    queryParams:{
				    	publicdurg_id:value 
				    },
				    pagination:true,
				    pageNumber:1,
				    pageSize:4,
				    pageList:[4,3],
				    columns:[[
			    		{field:'publicdurg_id',title:'发药单号',width:203.2},
						{field:'publicdurg_shuliang',title:'请领的发药数量',width:203.2},
						{field:'publicdurg_allmoney',title:'请领发药总金额',width:200.2},
						{field:'publicdurg_peope',title:'请领人',width:205},
						{field:'p_works',title:'操作',width:203.2,
							formatter:function(value,row,index){ 
							 //按钮
							 return "<a  class='lookout_drug_inhospital  easyui-linkbutton' onclick='lookout_drug_inhospital_record("+row.publicdurg_id+")'>查看记录</a>";
							}		
						}
				    ]]
				}); 
		  }
	    });
	
	
	   //住院未发药初始化
		$('#outPatientDrugMessage-tabRecord-Inhospital').datagrid({
		    url:'select_publicDrug_Inhospital?docdetails_type='+0+"&publicdurg_type="+1,
		    pagination:true,
		    pageNumber:1,
		    pageSize:4,
		    pageList:[4,3],
		    columns:[[
	    		{field:'publicdurg_id',title:'发药单号',width:203.2},
				{field:'publicdurg_shuliang',title:'请领的发药数量',width:203.2},
				{field:'publicdurg_allmoney',title:'请领发药总金额',width:200.2},
				{field:'publicdurg_lingyaopeople',title:'请领人',width:205},
				{field:'p_works',title:'操作',width:203.2,
					formatter:function(value,row,index){ 
					 //按钮
					 return "<a  class='lookout_drug_inhospital  easyui-linkbutton' onclick='lookout_drug_inhospital("+row.publicdurg_id+")'>查看药物</a>";
					}		
				}
		    ]]
		}); 
	
		//住院未发药查询
		$("#search_outNumber_inhospital").searchbox({
			searcher:function(value){
				//访问数据源、初始化表格
				$('#outPatientDrugMessage-tabRecord-Inhospital').datagrid({
			    url:'select_publicDrug_Inhospital?docdetails_type='+0+"&publicdurg_type="+1,
			    pagination:true,
			    pageNumber:1,
			    pageSize:4,
			    pageList:[4,3],
			    columns:[[
		    		{field:'publicdurg_id',title:'发药单号',width:203.2},
					{field:'publicdurg_shuliang',title:'请领的发药数量',width:203.2},
					{field:'publicdurg_allmoney',title:'请领发药总金额',width:200.2},
					{field:'publicdurg_lingyaopeople',title:'请领人',width:205},
					{field:'p_works',title:'操作',width:203.2,
						formatter:function(value,row,index){ 
						 //按钮
						 return "<a  class='lookout_drug_inhospital  easyui-linkbutton' onclick='lookout_drug_inhospital("+row.publicdurg_id+")'>查看药物</a>";
						}		
					}
			    ]]
			}); 
		 }
    });
	
	//门诊发药人员初始化
	$('#outPatientDrugMessage-tabRecord').datagrid({
	    url:'select_OutPatientStorage_people',
	    pagination:true,
	    pageNumber:1,
	    pageSize:4,
	    pageList:[4,3],
	    columns:[[
    		{field:'cliniccard_id',title:'医疗卡号',width:203.2},
			{field:'clinic_name',title:'病人名称',width:203.2},
			{field:'clinic_sex',title:'性别',width:200.2},
			{field:'clinic_idnumber',title:'身份证号',width:205},
			{field:'works',title:'操作',width:203.2,
				formatter:function(value,row,index){
				 //按钮
				 return "<a  class='lookout_drug  easyui-linkbutton' onclick='lookout_drug("+row.cliniccard_id+")'>查看药物</a>";
				}		
			}
	    ]]
	}); 
	
	 //门诊发药人员查询
 	$("#search_username").searchbox({
			searcher:function(value){
				//访问数据源、初始化表格
				 $('#outPatientDrugMessage-tabRecord').datagrid({
					url:'select_OutPatientStorage_people',
				    queryParams:{
				    	clinic_name:value 
				    },
				    pagination:true,
				    pageNumber:1,
				    pageSize:4,
				    pageList:[4,3],
				    columns:[[
			    		{field:'cliniccard_id',title:'医疗卡号',width:203.2},
						{field:'clinic_name',title:'病人名称',width:203.2},
						{field:'clinic_sex',title:'性别',width:200.2},
						{field:'clinic_idnumber',title:'身份证号',width:205},
						{field:'works',title:'操作',width:203.2,
							formatter:function(value,row,index){
							 //按钮
							 return "<a  class='lookout_drug  easyui-linkbutton' onclick='lookout_drug("+row.cliniccard_id+")'>查看药物</a>";
							}		
						}
				    ]]
				});
			}
 	    });
	
	//门诊已经发药记录初始化
	$('#outPatientDrug-tabRecord').datagrid({
	    url:'select_publicDrugPeople',
	    pagination:true,
	    pageNumber:1,
	    pageSize:4,
	    pageList:[4,3],
	    columns:[[
    		{field:'publicdurg_id',title:'发药单号',width:203.2},
			{field:'clinic_name',title:'病人名称',width:203.2},
			{field:'publicdurg_shijishuliang',title:'发药数量',width:203.2},
			{field:'publicdurg_allmoney',title:'药物总金额',width:202},
			{field:'cz',title:'操作',width:203.2,
				formatter:function(value,row,index){
				 //按钮
				 return "<a  class='lookout_drugrecord  easyui-linkbutton' onclick='lookout_Agodrugrecord("+row.publicdurg_id+")'>查看记录</a>";
				}		
			}
	    ]]
	}); 
	
	
	 //门诊已经发药记录查询
 	$("#search-sickname").searchbox({
			searcher:function(value){
				//访问数据源、初始化表格
				$('#outPatientDrug-tabRecord').datagrid({
				    url:'select_publicDrugPeople',
				    queryParams:{
				    	clinic_name:value 
				    },
				    pagination:true,
				    pageNumber:1,
				    pageSize:8,
				    pageList:[8,9],
				    columns:[[
			    		{field:'publicdurg_id',title:'发药单号',width:203.2},
						{field:'clinic_name',title:'病人名称',width:203.2},
						{field:'publicdurg_shijishuliang',title:'发药数量',width:203.2},
						{field:'publicdurg_allmoney',title:'药物总金额',width:202},
						{field:'cz',title:'操作',width:203.2,
							formatter:function(value,row,index){
							 //按钮
							 return "<a  class='lookout_drugrecord  easyui-linkbutton' onclick='lookout_Agodrugrecord("+row.publicdurg_id+")'>查看记录</a>";
							}		
						}
				    ]]
				}); 
			}
 	    });
	 
	 //住院发药提交
 	$("#Inhosdrug_submits").click(function(){
 		$("<form method='Post' id='for'>").appendTo("body").form({
			url:'addoutDrug-Inhospital',
			onSubmit:function(param){
				//获取发药类型状态-----2住院发药记录
				param["publicdurg.publicdurgType"] = 2;
				
				//发药人 
				param["publicdurg.publicdurgPeope"] =$("#Outpeople").val();				
				
				//获取住院发药表格药品信息
				var rows = $('#select_publicDrug-Inhostabs').datagrid("getRows");
				console.log(rows);
				
				//药品总数量
				var totalAmount=0;
				//总金额
				var totalmoney=0;
				for(var  i = 0;i < rows.length; i++){
					//医嘱详情的主键
					param["publicdurgdetail["+i+"].doctoradviceDetail.docdetailsId"] = rows[i]["docdetails_id"];
					
					//计算药品请领总数量
					totalAmount+= rows[i]["pd_details_shuliang"];
				
					//单个药品数量
					param["publicdurgdetail["+i+"].pdDetailsSjcount"] =rows[i]["pd_details_shuliang"];
				}	
				
				//请领总数量
				param["publicdurg.publicdurgShuliang"] =parseInt(totalAmount);
			},
			 success:function(data){
				 if(parseInt(data)==1){
						$(".window-apply").text("住院发药成功！！！");
						 $("#select-InhosDrugDetails-window").window('close');
						$("#applysaveclinic-win").window('open');
						$('#outPatientDrugMessage-tabRecord-Inhospital').datagrid("reload");
						$('#outPatientDrug-tabRecord-Inhospital').datagrid("reload");
				    	//三秒之后自动消失
					   setTimeout(function(){
						   $("#applysaveclinic-win").window('close');
						  }, 3000);
			    	
					     $('#for').form("clear");//清空文本
						$("#outPatientDrugMessage-tabRecord").datagrid("reload");
					}
					
					if(parseInt(data)==2){
					     $(".window-apply").text("发药失败,稍后重试......");
					     $("#select-InhosDrugDetails-window").window('close');
					     $("#outPatientDrugMessage-tabRecord-Inhospital").datagrid("reload");
					 	 $('#outPatientDrug-tabRecord-Inhospital').datagrid("reload");
			    	     $("#applysaveclinic-win").window('open');
				    	//三秒之后自动消失
					   setTimeout(function(){
					    	 $("#applysaveclinic-win").window('close');
						  }, 3000);
						
					}
			 }
	   }).submit();
 		 
 	});
}); 

//确认发药查看详情
function  lookout_drug(cliniccard_id){
	  var cliniccard_id=cliniccard_id;
	  //打开窗口
	 $("#select-OutPatientDetails-window").window('open');
	  //药房药物初始化
	 $('#select_OutPatientStorage_peopledetails-tabs').datagrid({
		    url:'select_OutPatientStorage_peopledetails?cliniccard_id='+cliniccard_id,
		    pagination:true,
		    pageNumber:1,
		    pageSize:6,
		    pageList:[6,7],
		    columns:[[
		    	{field:'docdetails_id',hidden:true},
		    	{field:'doc_drugallnumber',hidden:true},
				{field:'drug_number',title:'药品编号',width:164.1},
				{field:'drug_name',title:'药品名称',width:164.1},
				{field:'drug_retail_price',title:'药品零售价',width:164.1},
				{field:'drug_standard',title:'药品规格',width:164.1},
				{field:'drug_unit',title:'单位',width:164.1},
				{field:'docdetails_everynnum',title:'病人请领药品数量',width:162}
		    ]]
		});
 }
 
 //门诊查看已经发药记录
function lookout_Agodrugrecord(publicdurg_id){
	 //打开窗口
	 $("#select-OutPatientDrugDetails-window").window('open');
	 //门诊药房已经发药记录初始化
	 $('#select_publicDrug-tabs').datagrid({
		    url:'select_publicDrug?publicdurg_id='+publicdurg_id,
		    pagination:true,
		    pageNumber:1,
		    pageSize:6,
		    pageList:[6,7],
		    columns:[[
		    	{field:'pd_details_pici',title:'药品批次',width:80.1},
				{field:'drug_number',title:'药品编号',width:140.1},
				{field:'drug_name',title:'药品名称',width:123.1},
				{field:'drug_retail_price',title:'药品零售价',width:102.1},
				{field:'drug_unit',title:'单位',width:90.1},
				{field:'drug_standard',title:'药品规格',width:120.1},
				{field:'pd_details_sjcount',title:'实际发药数量',width:92.1},
				{field:'publicdurg_shuliang',title:'药品请领总数量',hidden:true},
				{field:'docdetails_id',title:'医嘱详情编号',hidden:true},
				{field:'docdetails_everynnum',title:'药品请领数量',width:90},
				{field:'pd_details_date',title:'发药时间',width:145.1,formatter:comFormatDate}
		    ]],
		    onLoadSuccess:function(data){
		 	    var rows = $("#select_publicDrug-tabs").datagrid("getRows");
		    	 //请领总数量
		 		var total=rows[0]["publicdurg_shuliang"];
		    	 //发药实际数量
		 		var shijitotal=0;
				for (var i = 0; i < rows.length; i++) {
					shijitotal+= rows[i]["pd_details_sjcount"];
				}
				//请领总数量 
				$("#outpatients_applyallnumber").textbox('setValue',parseInt(total));
				//实际总数量
				$("#outpatients_outallnumber").textbox('setValue',parseInt(shijitotal));
				//门诊已经发完药查看详情合并单元格(可清晰看到一个药品请领了多少数量)
				var start = 0;
				var end = 0;
				var mer = ['docdetails_id','docdetails_everynnum'];//需要合并的字段，即field
				//有数据就合并----对应数据的数量
				if (data.total > 0){
					//console.log("data.total:"+data.total);
				    var temp = data.rows[0].docdetails_id;   //需要比较的列-----一个药品请领数量
				    for (var i = 1; i < data.rows.length; i++) {
						if (temp == data.rows[i].docdetails_id) {
						     end++;
						} else {
						    if (end> start) {
								for(var j = 0; j < mer.length; j ++){
									$('#select_publicDrug-tabs').datagrid('mergeCells', {
										index: start,//起始索引
										rowspan: end - start + 1,  //需要合并的行数
										field: mer[j]
									});
								}
						   }
						    temp = data.rows[i].docdetails_id;
						    start = i;
						    end = i;
					 }
				 }
				    //这里是为了判断重复内容出现在最后的情况
				    if (end > start) {
						for(var j = 0; j < mer.length; j ++){
							$('#select_publicDrug-tabs').datagrid('mergeCells', {
								index: start,
								rowspan: end - start + 1,
								field: mer[j]
							});
						}
				    }
				}/* 最大if结束 */
				
		    }
		});
 }
 
 //住院发药查看详情
function lookout_drug_inhospital(publicdurg_id){
	  //打开窗口
	 $("#select-InhosDrugDetails-window").window('open');
	 //住院药房发药详情初始化
	 $('#select_publicDrug-Inhostabs').datagrid({
		    url:'select_publicDrug_InhospitalDetails?publicdurg_id='+publicdurg_id+"&docdetails_type="+0+"&publicdurg_type="+1,
		    pagination:true,
		    pageNumber:1,
		    pageSize:6,
		    pageList:[6,7],
		    columns:[[
		    	{field:'pd_details_id',hidden:true},
		    	{field:'docdetails_id',hidden:true},
		    	{field:'publicdurg_id',hidden:true},
				{field:'drug_number',title:'药品编号',width:146.1},
				{field:'drug_name',title:'药品名称',width:173.1},
				{field:'drug_retail_price',title:'药品零售价',width:121.1},
				{field:'drug_unit',title:'单位',width:110.1},
				{field:'drug_standard',title:'药品规格',width:173.1},
				{field:'pd_details_shuliang',title:'请领药品数量',width:112.1},
				{field:'pd_details_date',title:'发药时间',width:148.1,formatter:comFormatDate}
		    ]]
		});
}
 
//住院已经发药查看记录
function lookout_drug_inhospital_record(publicdurg_id){
	  //打开窗口
	 $("#select-InhosDrugDetails-window2").window('open');
	 //住院药房发药详情初始化
	 $('#select_publicDrug-Inhostabs2').datagrid({
		    url:'select_publicDrug_InhospitalDetails?publicdurg_id='+publicdurg_id+"&docdetails_type="+2+"&publicdurg_type="+2,
		    pagination:true,
		    pageNumber:1,
		    pageSize:6,
		    pageList:[6,7],
		    columns:[[
		    	{field:'pd_details_id',hidden:true},
		    	{field:'publicdurg_id',hidden:true},
		    	{field:'pd_details_pici',title:'药品批次',width:90},
				{field:'drug_number',title:'药品编号',width:140.1},
				{field:'drug_name',title:'药品名称',width:123.1},
				{field:'drug_retail_price',title:'药品零售价',width:100.1},
				{field:'drug_unit',title:'单位',width:80.1},
				{field:'drug_standard',title:'药品规格',width:140.1},
				{field:'pd_details_sjcount',title:'发药实际数量',width:80.1},
				{field:'docdetails_id',hidden:true},
				{field:'pd_details_shuliang',title:'实际请领数量',width:82,
				   formatter:function(value,row,index){
					   return row.pd_details_sjcount;
				   }	
				},
				{field:'pd_details_date',title:'发药时间',width:148.1,formatter:comFormatDate}
		    ]],
		    onLoadSuccess:function(data){
		 	    var rows = $("#select_publicDrug-Inhostabs2").datagrid("getRows");
		    	 //请领总数量
		 		var total=rows[0]["publicdurg_shuliang"];
		    	 //发药实际数量
		 		var shijitotal=0;
				for (var i = 0; i < rows.length; i++) {
					shijitotal+= rows[i]["pd_details_sjcount"];
				}
				//请领总数量
				$("#Instorage_applyallnumber2").textbox('setValue',parseInt(total));
				//实际总数量
				$("#Instorage_allnumber2").textbox('setValue',parseInt(shijitotal));
				
				//门诊已经发完药查看详情合并单元格(可清晰看到一个药品请领了多少数量)
				var start = 0;
				var end = 0;
				var mer = ['docdetails_id','publicdurg_shuliang'];//需要合并的字段，即field
				//有数据就合并----对应数据的数量
				if (data.total > 0){
					//console.log("data.total:"+data.total);
				    var temp = data.rows[0].docdetails_id;   //需要比较的列-----一个药品请领数量
				    for (var i = 1; i < data.rows.length; i++) {
						if (temp == data.rows[i].docdetails_id) {
						     end++;
						} else {
						    if (end> start) {
								for(var j = 0; j < mer.length; j ++){
									$('#select_publicDrug-Inhostabs2').datagrid('mergeCells', {
										index: start,//起始索引
										rowspan: end - start + 1,  //需要合并的行数
										field: mer[j]
									});
								}
						   }
						    temp = data.rows[i].docdetails_id;
						    start = i;
						    end = i;
					 }
				 }
				    //这里是为了判断重复内容出现在最后的情况
				    if (end > start) {
						for(var j = 0; j < mer.length; j ++){
							$('#select_publicDrug-Inhostabs2').datagrid('mergeCells', {
								index: start,
								rowspan: end - start + 1,
								field: mer[j]
							});
						}
				    }
				}/* 最大if结束 */
		    }
		});
}
 
 //门诊确认发药
 $("#Outdrug_submits").click(function(){
	 //首先根据药品id查询到药品所有的批次
	 $("<form method='post' id='for'>").appendTo("body").form({
			url:'AddOutPatient_Publicdrug',
			onSubmit:function(param){
				//获取发药类型状态---门诊
				param["publicdurg.publicdurgType"]=0;
				
				//发药表---药房发药人
				param["publicdurg.publicdurgPeope"] =$("#Outpeople").val();
				console.log(param["publicdurg.publicdurgPeope"]);
				
				//发药表---领药人=null
				param["publicdurg.publicdurgLingyaopeople"] =null;
		
				//获取表格中的发药的记录
				var rows = $("#select_OutPatientStorage_peopledetails-tabs").datagrid("getRows");
				console.log(rows);
				
				var total=0;
				var money=0;
				for(var  i = 0;i < rows.length; i++){
					//医嘱详情的主键
					param["publicdurgdetail["+i+"].doctoradviceDetail.docdetailsId"] = rows[i]["docdetails_id"];
					
					//计算药品总数量
					total +=parseInt(rows[i]["docdetails_everynnum"]); 
				
					//单个药品数量
					param["publicdurgdetail["+i+"].pdDetailsShuliang"] =rows[i]["docdetails_everynnum"];
					
					
				}	
				  //请领发药总数量
				  param["publicdurg.publicdurgShuliang"] =  parseInt(total);
				 
			},
			success:function(data){
				if(parseInt(data)==1){
						$(".window-apply").text("门诊发药成功！！！");
						$("#select-OutPatientDetails-window").window('close');
						$("#applysaveclinic-win").window('open');
						$('#outPatientDrug-tabRecord').datagrid("reload");
				    	//三秒之后自动消失
					   setTimeout(function(){
						   $("#applysaveclinic-win").window('close');
						  }, 3000);
			    	
					     $('#for').form("clear");//清空文本
						$("#outPatientDrugMessage-tabRecord").datagrid("reload");
					}
					
					if(parseInt(data)==2){
					     $(".window-apply").text("发药失败,稍后重试......");
					     $("#select-OutPatientDetails-window").window('close');
			    	     $("#applysaveclinic-win").window('open');
				    	//三秒之后自动消失
					   setTimeout(function(){
					    	 $("#applysaveclinic-win").window('close');
						  }, 3000);
			    	
					     $('#for').form("clear");//清空文本
						$("#outPatientDrugMessage-tabRecord").datagrid("reload");
					}
				
			}
	   }).submit();
 });
 
//格式化时间
	function comFormatDate(date) {
		var day = new Date(date); 
		var Year = 0; 
		var Month = 0; 
		var Day = 0; 
		var CurrentDate = ""; 
		//初始化时间 
		Year= day.getFullYear();//ie火狐下都可以 
		Month= day.getMonth()+1; 
		Day = day.getDate(); 
		Hour = day.getHours(); 
		 Minute = day.getMinutes(); 
		 Second = day.getSeconds(); 
		CurrentDate += Year + "-"; 
		if (Month >= 10 ) { 
			CurrentDate += Month + "-"; 
		}else { 
			CurrentDate += "0" + Month + "-"; 
		} 
		if (Day >= 10 ) { 
			CurrentDate += Day ; 
		}else { 
			CurrentDate += "0" + Day ; 
		} 
		if(Hour>=10){
			CurrentDate +=" "+Hour;
		}else{
			CurrentDate +=" "+"0"+Hour;
		}
		if(Minute>=10){
			CurrentDate +=":"+Minute;
		}else{
			CurrentDate +=":"+"0"+Minute;
		}
		if(Second>=10){
			CurrentDate +=":"+Second;
		}else{
			CurrentDate +=":"+"0"+Second;
		}
		return CurrentDate; 
	}
	

</script>		
<!-- 选项卡 -->
<div id="tab_" class="easyui-tabs" style="fit:true;"> 
	 <div title="门诊发药">
		  <!-- 面板	 -->
		  <fieldset style="border:1px solid #A6A6A6;border-radius:6px;width:1050px;overflow: hidden;margin:0 auto;margin-top:10px;">
		    <legend style="font-size:17px">发药信息</legend>
		        <a style="margin-left:14px;">
					<input id="search_username" name="search-checkdrugname" 
					class="easyui-searchbox"  data-options="width:160,height:30,prompt:'请输入病人名称或医疗卡'">
				  </a>			       
		     <div style="margin-left:15px;margin-top:8px;">
			     	<table id="outPatientDrugMessage-tabRecord" class="easyui-datagrid" data-options="fitColumns:false,checkOnSelect:false,width:1016,height:156" >
				  
				    </table>
			</div>	<!-- tab盒子 -->
		</fieldset>
		
		 <fieldset style="border:1px solid #A6A6A6;border-radius:6px;width:1050px;overflow: hidden;margin:0 auto;margin-top:10px;">
		    <legend style="font-size:17px">发药记录</legend>
		        <a style="margin-left:14px;">
					<input id="search-sickname" name="search-sickname" 
					class="easyui-searchbox"  data-options="width:160,height:30,prompt:'输入病人名字或发药单号'">
				  </a>			       
		     <div style="margin-left:15px;margin-top:8px;">
			     	<table id="outPatientDrug-tabRecord" class="easyui-datagrid" data-options="fitColumns:false,checkOnSelect:false,width:1016,height:141" >
				  
				    </table>
			</div>	<!-- tab盒子 -->
		</fieldset>
    </div>
   <!--  住院发药 -->
     <div title="住院发药">
		  <!-- 面板	 -->
		  <fieldset style="border:1px solid #A6A6A6;border-radius:6px;width:1050px;overflow: hidden;margin:0 auto;margin-top:10px;">
		    <legend style="font-size:17px">住院发药信息</legend>
		        <a style="margin-left:14px;">
					<input id="search_outNumber_inhospital" name="search-checkdrugname" 
					class="easyui-searchbox"  data-options="width:150,height:30,prompt:'请输入发药单号'">
				  </a>			       
		     <div style="margin-left:15px;margin-top:8px;">
			     	<table id="outPatientDrugMessage-tabRecord-Inhospital" class="easyui-datagrid" data-options="fitColumns:false,checkOnSelect:false,width:1016,height:156" >
				  
				    </table>
			</div>	<!-- tab盒子 -->
		</fieldset>
		
	  <fieldset style="border:1px solid #A6A6A6;border-radius:6px;width:1050px;overflow: hidden;margin:0 auto;margin-top:10px;">
		    <legend style="font-size:17px">住院发药记录</legend>
		        <a style="margin-left:14px;">
					<input id="search-sickname-inhospital" name="search-sickname-inhospital" 
					class="easyui-searchbox"  data-options="width:150,height:30,prompt:'请输入发药单号'">
				  </a>			       
		     <div style="margin-left:15px;margin-top:8px;">
			     	<table id="outPatientDrug-tabRecord-Inhospital" class="easyui-datagrid" data-options="fitColumns:false,checkOnSelect:false,width:1016,height:141" >
				  
				    </table>
			</div>	<!-- tab盒子 -->
		</fieldset>
		
    </div>
    
</div>

<!-- 根据人员查询门诊发药详情 -->
   <div id="select-OutPatientDetails-window" class="easyui-window" title="药物信息" style="width:1015px;height:465px;"
  data-options="iconCls:'icon-save',closed:true,modal:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
    <div style="margin-left:7px;margin-top:15px;">
           <table id="select_OutPatientStorage_peopledetails-tabs" class="easyui-datagrid" data-options="fitColumns:false,singleSelect:true,width:985,height:349" >
 
             </table>
           <p style="width:100px;margin:0 auto;margin-left: 42%;display:inline-block;margin-top:25px;">
 		          <a  id="Outdrug_submits" class="easyui-linkbutton"   
 		          data-options="iconCls:'icon-ok',border:false">确认发药</a> 
          </p>
    </div>
</div><!-- select-OutPatientDetails-window结束 -->	

<input type="hidden" value="${user.userName}"  id="Outpeople">
<!-- 弹框提示 -->
<div id="applysaveclinic-win" class="easyui-window"  title="提示框" style="width:300px;height:156px"
    data-options="iconCls:'icon-save',modal:true,resizable:false,collapsible:false,maximizable:false,minimizable:false,closed:true">
          <p class="window-apply" style=" margin-left: 72px;font-size: 16px;margin-top: 47px;">
          </p>
</div>

<!-- 根据人员查询门诊发药记录详情 -->
   <div id="select-OutPatientDrugDetails-window" class="easyui-window" title="药物信息" style="width:1015px;height:465px;"
  data-options="iconCls:'icon-save',closed:true,modal:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
       <p>
	    <a style="margin-left:7px;">  
                 <span style="margin-right:7px;">请领药品总数量</span>
                 <input id="outpatients_applyallnumber" class="easyui-textbox" style="width:130px" data-options="width:130,height:30,required:true,readonly:true"/>
	    </a>
	     <a style="margin-left:15px;">  
                 <span style="margin-right:7px;">发货药品总数量</span>
                 <input id="outpatients_outallnumber" class="easyui-textbox" style="width:130px" data-options="width:130,height:30,required:true,readonly:true"/>
	    </a>
   </p>
    
    <div style="margin-left:7px;margin-top:15px;">
           <table id="select_publicDrug-tabs" class="easyui-datagrid" data-options="fitColumns:false,singleSelect:true,width:985,height:349" >
 
             </table>
    </div>
</div><!-- select-OutPatientDrugDetails-window结束 -->	


<!-- 根据发药单号查询住院发药记录详情 -->
   <div id="select-InhosDrugDetails-window" class="easyui-window" title="住院发药信息" style="width:1015px;height:465px;"
  data-options="iconCls:'icon-save',closed:true,modal:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
    <div style="margin-left:7px;margin-top:15px;">
           <table id="select_publicDrug-Inhostabs" class="easyui-datagrid" data-options="fitColumns:false,singleSelect:true,width:985,height:349" >
 
           </table>
           
            <p style="width:100px;margin:0 auto;margin-left: 42%;display:inline-block;margin-top:25px;">
 		          <a  id="Inhosdrug_submits" class="easyui-linkbutton"   
 		          data-options="iconCls:'icon-ok',border:false">确认发药</a> 
           </p>
    </div>
</div><!-- select-OutPatientDrugDetails-window结束 -->	

<!-- 根据发药单号查询已经住院发药记录详情 -->
<div id="select-InhosDrugDetails-window2" class="easyui-window" title="住院发药信息" style="width:1015px;height:465px;"
  data-options="iconCls:'icon-save',closed:true,modal:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
      <p>
	    <a style="margin-left:7px;">  
                 <span style="margin-right:7px;">请领药品总数量</span>
                 <input id="Instorage_applyallnumber2" class="easyui-textbox" style="width:130px" data-options="width:130,height:30,required:true,readonly:true"/>
	    </a>
	     <a style="margin-left:15px;">  
                 <span style="margin-right:7px;">发货药品总数量</span>
                 <input id="Instorage_allnumber2" class="easyui-textbox" style="width:130px" data-options="width:130,height:30,required:true,readonly:true"/>
	    </a>
   </p>
    <div style="margin-left:7px;margin-top:15px;">
           <table id="select_publicDrug-Inhostabs2" class="easyui-datagrid" data-options="fitColumns:false,singleSelect:true,width:985,height:319" >
 
           </table>
    </div>
</div><!-- select-OutPatientDrugDetails-window结束 -->	

</body>
</html>
